//
//  duibiaoTableCell.m
//  cocoapodText
//
//  Created by apple on 16/9/27.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "ShiPei.h"
#import "duibiaoTableCell.h"
#import <Foundation/Foundation.h>


@interface duibiaoTableCell()
@property(nonatomic,strong) duibiaoDataTableCellview *tableCellView;
@end

@implementation duibiaoTableCell

//重写构造方法，让自定义的cell一创建出来就有四个子控件
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setFrame:[ShiPei CGRectMakeScale:0 :0 :TabChildContentW :35]];
        
        duibiaoDataTableCellview *tableCellView=[[duibiaoDataTableCellview alloc] initWithFrame:[ShiPei CGRectMakeScale:0 :0 :TabChildContentW :35]];
        [self addSubview:tableCellView];
        [tableCellView setBackgroundColor:[UIColor clearColor]];
        self.tableCellView=tableCellView;
    }
    return self;
}

/**
 *  重写set方法
 *
 *  @param car
 */
-(void)setQueryInfo:(duibiaoDataInfo *)queryInfo{
    //不要忘了，记录传递进来的模型
    _queryInfo=queryInfo;
    //给子控件赋值数据
    [self settingData];
}
/**
 *  对子控件的数据进行设置
 */
-(void)settingData{
    if ([_queryInfo.isOdd isEqualToString:@"1"]) {
        [self setBackgroundColor:FUIColorFromRGB(0xf2f8fd)];
    }else{
        [self setBackgroundColor:[UIColor whiteColor]];
    }
    [_tableCellView setName:_queryInfo.itemName];
    [_tableCellView setKWH:_queryInfo.itemKWH];
    [_tableCellView setCoal:_queryInfo.itemCoal];
    [_tableCellView setCarbon:_queryInfo.itemCarbon];
    [_tableCellView setMaxmin:_queryInfo.itemMaxmin];
}

@end

